package top.lyc829.leetcode.T268;

public class Solution {

    public int missingNumber(int[] nums) {

        int count = 0;
        int tmp = 0;

        for (int i = 0; i < nums.length; i++) {
            tmp = tmp + i + 1;
            count += nums[i];
        }

        return tmp - count;

    }

    public static void main(String[] args) {
        Solution s = new Solution();

        int res = s.missingNumber(new int[]{3, 0, 1});
        System.out.println(res);

    }

}
